Introduction

In this extended activity, you will add enhancements to the Guessing Game web application starting with the code in this zipfile. It is expected that you will complete the first two enhancements. You can get bonus exercise points, and more experience with the technologies that you will use for the project, by implementing the third, fourth, or both, enhancements.

Enhancement 1 (2 exercise points): Global Game Stats

User Story

As a player I want to see the percentage of games won across all players.

Acceptance Criteria

  1. Given that the player is connected to the web application when the Application Stats message is displayed then the message "Players have won X% of the games played" where X is the percentage of games rounded to the nearest whole percentage that were won since the web application started. Note: the percentage is calculated at the time that the message is rendered.

Enhancement 2 (2 exercise points): My Game Stats

User Story

As a player I want to see the percentage of games I have won in my current session.

Acceptance Criteria

  1. Given that the player is connecting to the web application for a new session when the Home page displays then the message "No game stats yet" will be shown.
  2. Given that the player has not won any games when the player loses a game then the message "You have not won a game, yet. But I *feel* your luck changing." will be shown on the Home page
  3. Given that the player has not won any games when the player wins a game or
    Given
    that the player has already won a game when the player finishes a game
    then the message "You have won an average of X% of this session's N games" will be shown on the Home page where X is the percentage of wins rounded to the nearest whole percentage and N is the total number of games for this player.

Enhancement 3 (1 bonus exercise point): Provide Hint

User Story

As a player I want to get a hint when my guess is incorrect.

Acceptance Criteria

  1. Given that the player has more than one guess left when the player makes a valid but incorrect guess then the Game view will show a message "The number is lower/higher than your guess" where lower/higher is chosen based on the guess and the hidden number.

Enhancement 4 (2 bonus exercise points): Game Levels

User Story

As a player I want to select between three levels of difficulty.

Acceptance Criteria

  1. Given that the player is not in a game when a page displays offering to start a game then the player will have the option to select one of three levels of game difficulty: standard, moderate, difficult.
  2. Given that the player is not in a game when the player selects a game difficulty level then the player will start a game with characteristics given in the table below.
Game difficulty Hidden number range Number of guesses
Standard 0-9 3
Moderate 0-24 5
Difficult 0-24 3

Submission